package com.qiche.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

@Data
@Table(name = "insurance_policy")
public class InsurancePolicy {
    @Id
    private Long id;

    @NotBlank
    private String code;
    @NotNull
    @Column(name = "customer_id")
    private Long customerId;

    @Column(name = "merchant_id")
    private Long merchantId;

    private String applicant;

    @Column(name = "company_type")
    private Integer companyType;
    
    @Pattern(regexp = "^1[3|4|5|7|8][0-9]{9}$",message="请输入合法的手机号码")
    private String phone;

    @Column(name = "brand_id")
    private Long brandId;

    @Column(name = "vehicle_id")
    private Long vehicleId;
    @NotNull
    @Column(name = "customer_car_id")
    private Long customerCarId;

    @Column(name = "car_info")
    private String carInfo;

    @Column(name = "vin_code")
    private String vinCode;

    @Column(name = "plate_number")
    private String plateNumber;
    @Column(name = "frame_number")
    private String frameNumber;
    /**
     * 返利费用
     */
    @Column(name = "return_money")
   /* @NotNull
    @Min(value = 0)*/
    private Double returnMoney;
    /**
     * 保单费用
     */
    @Column(name = "policy_money")
   /* @NotNull
    @Min(value = 0)*/
    private Double policyMoney;

    private Byte status;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "expiry_time")
    @NotNull
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date expiryTime;
    
    @Column(name="policy_name")
    private String policyName;
    
    @Column(name="policy_phone")
    private String policyPhone;

    @Transient
    private BigDecimal minPolicyMoney;
    @Transient
    private BigDecimal maxPolicyMoney;
}